package com.pds.web.testOrganization.controller;

import com.pds.common.core.controller.BaseController;
import com.pds.common.core.domain.R;
import com.pds.common.core.page.TableDataInfo;
import com.pds.web.testOrganization.domain.PdsTestOrganizationHonor;
import com.pds.web.testOrganization.domain.PdsTestOrganizationInspect;
import com.pds.web.testOrganization.service.IPdsTestOrganizationInspectService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api
@RestController
@RequestMapping("/inspect")
public class PdsTestOrganizationInspectController extends BaseController {

    @Autowired
    private IPdsTestOrganizationInspectService pdsTestOrganizationInspectService;

    /**
     * 新增
     *
     * @param pdsTestOrganizationInspect
     * @return
     */
    @PostMapping("/add")
    public R<PdsTestOrganizationInspect> add(@RequestBody PdsTestOrganizationInspect pdsTestOrganizationInspect) {


        return R.ok(pdsTestOrganizationInspectService.addInspect(pdsTestOrganizationInspect));
    }

    /**
     * 删除 -- 根据ID
     *
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    public R<Boolean> delete(Long id) {
        return R.ok(pdsTestOrganizationInspectService.deleteInspect(id));
    }

    /**
     * 更新
     * @param pdsTestOrganizationInspect
     * @return
     */

    @PutMapping("/update")
    public R<Boolean> update(@RequestBody PdsTestOrganizationInspect pdsTestOrganizationInspect){
        return R.ok(pdsTestOrganizationInspectService.updateInspect(pdsTestOrganizationInspect));
    }

    /**
     * 查询
     * @param pdsTestOrganizationInspect
     * @return
     */

    @GetMapping("/list")
    public TableDataInfo list(PdsTestOrganizationInspect pdsTestOrganizationInspect){
        startPage();
        List<PdsTestOrganizationInspect> list = pdsTestOrganizationInspectService.selectInspectlist(pdsTestOrganizationInspect);
        return getDataTable(list);
    }
}
